<template>
    <div>
        <!--tab-->
        <Tabcomponent></Tabcomponent>
        <!--轮播图-->
        <div class="rotation1">
            <el-carousel :interval="5000" arrow="always">
                <el-carousel-item v-for="item in 4" :key="item" class="rotation-item">
                    <h3>{{ item }}</h3>
                </el-carousel-item>
            </el-carousel>
            <div class="poster">
                <div class="poster-text">MAXSOO 精选马衔扣手袋</div>
                <div class="poster-text1">点击购买</div>
            </div>
        </div>
        <!--内容-->
        <FlagshipItem></FlagshipItem>

        <div class="operation" v-if="isshow">
            <div class="operation-item">
                <span class="iconfont icon-icon_pc icon"></span>
                <div>个人中心</div>
            </div>
            <div class="operation-item" @click="toindex" style="border-top: 1px solid #fff;border-bottom: 1px solid #fff;">
                <span class="iconfont icon-shouye icon"></span>
                <div>回到首页</div>
            </div>
            <div class="operation-item" @click="totop">
                <span class="iconfont icon-gengxin icon"></span>
                <div>TOP</div>
            </div>
        </div>
    </div>
</template>

<script>
import FlagshipItem from '@/components/Flagship-Item.vue'
import Tabcomponent from '@/components/Tabcomponent.vue'
export default {
    components:{
        FlagshipItem,
        Tabcomponent
    },
    data() {
        return {
             tablist:[
            {
                name:'男士',
            },
            {
                name:'女士',
            },
            {
                name:'周边',
            },
            {
                name:'其他',
            }],
            drawer: false,
            isshow: false,
        }
    },
    methods: {
        totop() {
            var timer = setInterval(()=>{
                document.documentElement.scrollTop = document.documentElement.scrollTop-50
                if(document.documentElement.scrollTop==0){
                    clearInterval(timer); 
                }
            },50)
        },
        showIcon() {
            if (!!document.documentElement.scrollTop && document.documentElement.scrollTop >= 684 && document.documentElement.scrollTop < 7123) {            
                this.isshow = true
            } else {
                this.isshow = false
            }
        
        },
        toindex() {
            this.$router.push({
                path: '/'
            })
        },
    },
     mounted() {
        window.addEventListener("scroll", this.showIcon);
    },
}
</script>

<style lang="scss">
.rotation1 {
    width: 100%;
    height: 684px;
    position: relative;
    .rotation-item {
        height: 100%;
    }
    .poster {
        width: 544px;
        height: 148px;
        position: absolute;
        top: 50%;
        left: 50%;
        margin: -00px 0 0 -272px;
        z-index: 2;
        text-align: center;
        .poster-text {
            font-size: 44px;
            color: #fff;
        }
        .poster-text1 {
            width: 160px;
            height: 45px;
            background: #000;
            line-height: 45px;
            font-size: 14px;
            color: #fff;
            margin-top: 30px;
        }
    }
}

.operation {
    position: fixed;
    right: 0;
    top: 231px;
    z-index: 3;
    .operation-item {
        background: #000;
        width: 62px;
        height: 82px;
        text-align: center;
        padding-top: 18px;
        >.icon {
            font-size: 28px;
            color: #fff;
        }
        >div {
            font-size: 14px;
            color: #fff;
            margin-top: 8px;
        }
    }
}
.el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 684px;
    margin: 0;
}
.el-carousel__container {
    height: 684px;
}
.el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
}
.el-carousel__button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.el-carousel__arrow {
    width: 100px;
    height: 100px;
    background: none;
    font-size: 100px;
    display: none;
}
.el-carousel__arrow:hover {
    background-color: none;
}
.el-drawer.btt, .el-drawer.ttb, .el-drawer__container {
    left: 0;
    top: 138px;
    width: 100%;
}
</style>